<template>
    <div id="app">
      <el-form label-width="100px">

        <el-form-item label="密码">
          <el-input v-model="pwd" type="password"></el-input>
        </el-form-item>

        <el-form-item label="确认密码">
          <el-input v-model="repwd" type="password"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click.prevent="test">确认修改</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          pwd:"",
          repwd:""
        }
      },
      methods:{
        test(){
            this.$confirm("是否确认修改","保存提示").then(()=>{
              if(this.pwd!=this.repwd){
                this.$message.error("两次密码不一致");
                return;
              }
              let role=sessionStorage.getItem("role");
              this.axios.put("/user/xg?role="+role+"&pwd="+this.pwd).then((resp)=>{
                  this.$message.success("保存成功！");
                  this.$router.push("/")
                });
            });

        }
      }
    }
</script>


<style scoped>

</style>
